home *** CD-ROM | disk | FTP | other *** search
- /*
- ┌────────────────────────────────────────────────────────────────────────────┐
- │Title : jzfndfst │
- │Purpose : find the first matching file from a given file spec │
- │Notes: You must define a directory record from the type TDIR, defined in │
- │ in jzdirect.h │
- │Parms: │
- │ fmask - i.e. "*.*" │
- │ fattr - file attribute to use for search. use 32 for normal searches │
- │ fdta - TDIR variables │
- │ │
- │i.e. error = jzfndfst ( "*.*" , 0x20 , &dir_record ) │
- │Written by Jack Zucker - 75766,1336 301-794-5950 on 1/15/85 │
- └────────────────────────────────────────────────────────────────────────────┘
- */
-
- jzfndfst (fmask,fattr,fdta)
- int fmask;
- int fattr;
- int fdta;
- {
- union REGS winreg,woutreg;
-
- winreg.x.dx = fdta; /* get address of dir record */
- winreg.h.ah = 0x1a; /* set dta function */
- intdos(&winreg,&woutreg);
-
- winreg.x.dx = fmask;
- winreg.h.ah = 0x4e; /* find first matching file */
- winreg.x.cx = fattr; /* set file attribute for search */
- intdos(&winreg,&woutreg);
- if (woutreg.x.cflag & 0x0001 == 1) return(woutreg.x.ax);
- else return(0); /* return 0 if no error, otherwise dos error code */
- }